package com.sc.nft.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.dto.ActivityDTO;
import com.sc.nft.dto.ActivityPageDTO;
import com.sc.nft.dto.MallGoodsLabelQueryPageDTO;
import com.sc.nft.dto.MiniMallActivityPageDTO;
import com.sc.nft.dto.QueryMiniMallActivitySelectDTO;
import com.sc.nft.entity.MallActivity;
import com.sc.nft.entity.MallUserActivitySummary;
import com.sc.nft.entity.UserInfo;
import com.sc.nft.entity.WxMiniUserInfo;
import com.sc.nft.entity.dto.ActivityCouponsProductDTO;
import com.sc.nft.entity.dto.ActivityShareProductDTO;
import com.sc.nft.entity.dto.BuyLimitDTO;
import com.sc.nft.entity.dto.PreferenceActivityDTO;
import com.sc.nft.entity.vo.MallActivityUpdateShowChannelVO;
import com.sc.nft.entity.vo.mall.ActivityDetailV2VO;
import com.sc.nft.entity.vo.mall.ActivityDetailVO;
import com.sc.nft.entity.vo.mall.ActivityMiniMallDetailVO;
import com.sc.nft.entity.vo.mall.ActivityPageVO;
import com.sc.nft.entity.vo.mall.AdminSalesPageVO;
import com.sc.nft.entity.vo.mall.BargainPriceProductPageVO;
import com.sc.nft.entity.vo.mall.CategoryProductPageVO;
import com.sc.nft.entity.vo.mall.HotSaleActivityPageVO;
import com.sc.nft.entity.vo.mall.MallActivitySalesPriceUpdateVO;
import com.sc.nft.entity.vo.mall.MallActivityStockUpdateVO;
import com.sc.nft.enums.ApprovalStatusEnum;
import com.sc.nft.enums.ProductTypeEnum;
import com.sc.nft.enums.mallcart.CartExpiredEnum;
import com.sc.nft.enums.task.ActivityTypeEnum;

import java.util.Date;
import java.util.List;

/**
 * IP商城营销活动表服务接口
 *
 * @author zxy
 * @description IP商城
 * @since 2023-05-10 16:59:01
 */
public interface MallActivityService {

    /**
     * 查询已结束的活动
     *
     * @return
     */
    List<MallActivity> queryFinishedActivities();

    /**
     * 根据活动id和审核状态查询
     *
     * @param activityId
     * @param approvalStatus
     * @return
     */
    MallActivity getByIdAndApprovalStatus(Long activityId, ApprovalStatusEnum approvalStatus);

    MallActivity getCanBuy(Long activityId);

    /**
     * 活动列表
     */
    IPage<ActivityPageDTO> queryActivity(
            Long daoId,
            Boolean status,
            Boolean recommend,
            ApprovalStatusEnum approvalStatus,
            ProductTypeEnum productType,
            ActivityTypeEnum activityType,
            String productName,
            Boolean isMiniMall,
            Page toMp);

    /**
     * 客户端活动列表
     */
    IPage<ActivityPageVO> activityPage(
            Long daoId,
            Long categoryId,
            ActivityTypeEnum activityType,
            ProductTypeEnum type,
            String productName,
            Page page,
            Boolean isSaas,
            Boolean isMiniMall);

    /**
     * 获取三张图片
     *
     * @return
     */
    List<String> getThreeImage();

    /**
     * 活动详情
     *
     * @param id
     * @return
     */
    ActivityDTO detail(Long id);

    BuyLimitDTO convertBuyLimit(MallActivity activity, MallUserActivitySummary mallUserActivitySummary);

    /**
     * 客户端活动详情
     *
     * @param id
     * @param shareTeamId 分享购团队ID
     * @return
     */
    ActivityDetailVO activityDetail(
            UserInfo userInfo, Long id, Long shareTeamId, ActivityTypeEnum exchangeForActivity);

    ActivityDetailV2VO activityDetailV2(UserInfo userInfo, Long id, Long shareTeamId, ActivityTypeEnum exchangeForActivity);

    /**
     * 活动审核
     *
     * @param id
     * @param pass
     * @param remark
     * @return
     */
    void activityApproval(Long id, Boolean pass, String remark);

    IPage<HotSaleActivityPageVO> hotSaleProductPage(String productName, Integer hotSaleSort, Page mp);

    /**
     * 好物优选列表
     *
     * @param page
     * @return
     */
    Page<PreferenceActivityDTO> preferenceProductPage(Page page);

    IPage<BargainPriceProductPageVO> bargainPriceProductPage(
            String productName, Integer bargainPriceSort, Page mp, Boolean isSaas);

    IPage<CategoryProductPageVO> categoryProductPage(
            Long id, String productName, Integer sort, Boolean isVirtual, Page mp, Boolean isSaas, Boolean showMiniMall);

    IPage<CategoryProductPageVO> miniMallCategoryProductPage(
            Long id, String productName, Integer sort, Boolean isVirtual, Page mp, Boolean isSaas, Boolean showMiniMall);


    IPage<AdminSalesPageVO> getSalesPage(Page page);

    /**
     * 活动商品下架
     *
     * @param id
     */
    void offShelf(Long id);

    /**
     * 修改活动商品库存
     *
     * @param mallActivitySpecsUpdateVO
     * @return
     */
    void updateMallActivityStock(MallActivityStockUpdateVO mallActivitySpecsUpdateVO);

    /**
     * 修改活动商品渠道
     *
     * @param mallActivityStockUpdateVO
     */
    void updateShowChannel(MallActivityUpdateShowChannelVO mallActivityStockUpdateVO);

    /**
     * 修改活动商品售价
     *
     * @param mallActivitySalesPriceUpdateVO
     * @return
     */
    void updateMallActivitySalesPrice(MallActivitySalesPriceUpdateVO mallActivitySalesPriceUpdateVO);

    /**
     * 检查商品是否又上架的营销活动
     */
    boolean checkProductActivity(Long productId);

    /**
     * 获取优惠券中的活动商品列表
     *
     * @param ids
     * @param toMp
     * @return
     */
    Page<ActivityCouponsProductDTO> getActivityCouponsProductDTOPage(List<Long> ids, Page toMp, Integer status);

    /**
     * 获取优惠券中的活动商品列表
     *
     * @param ids
     * @return
     */
    List<ActivityCouponsProductDTO> getActivityCouponsProductDTOList(List<Long> ids);

    /**
     * 获取可添加至优惠券的活动商品列表
     *
     * @param page
     * @param productName
     * @return
     */
    Page<ActivityCouponsProductDTO> getActivityCouponsCanUseProductDTOPage(
            Page page, String productName);

    /**
     * 获取可添加至分享购下的活动商品列表
     *
     * @param page
     * @param productName
     * @param daoId
     * @return
     */
    Page<ActivityShareProductDTO> getActivityShareCanUseProductDTOPage(
            Page page, String productName, Long daoId);

    /**
     * 获取营销活动
     *
     * @param id
     * @return
     */
    MallActivity getById(Long id);

    /**
     * 商城全部分类
     *
     * @param daoId
     * @param categoryId
     * @param activityType
     * @param productType
     * @param productName
     * @param mp
     * @param sort
     * @return
     */
    IPage<ActivityPageVO> allCategories(
            Long daoId,
            Long categoryId,
            ActivityTypeEnum activityType,
            ProductTypeEnum productType,
            String productName,
            Page mp,
            Integer sort,
            Boolean isMiniMall);

    /**
     * 获取IP商城商品列表
     *
     * @param mp
     * @return
     */
    IPage<AdminSalesPageVO> getProductPage(Page mp);

    /**
     * 校验购物车商品是否已失效
     *
     * @param activityId
     * @param activitySpecsId
     * @return
     */
    CartExpiredEnum checkCartExpired(Long activityId, Long activitySpecsId, WxMiniUserInfo wxMiniUserInfo, Integer buyCount);

    /**
     * 选择小程序商品
     *
     * @param daoId
     * @param status
     * @param recommend
     * @param approvalStatus
     * @param productName
     * @param showMiniMall
     * @param mp
     * @return
     */
    IPage<MiniMallActivityPageDTO> queryActivityByMiniMall(Long daoId, Boolean status, Boolean recommend, ApprovalStatusEnum approvalStatus, String productName, Boolean showMiniMall, Page mp, Long templateId);

    /**
     * 小程序商品详情
     *
     * @param id
     * @return
     */
    ActivityMiniMallDetailVO miniMallDetail(Long id, String openId);

    /**
     * 小程序商品下拉框
     *
     * @param id
     * @param productName
     * @return
     */
    List<QueryMiniMallActivitySelectDTO> QueryMiniMallActivitySelect(Long id, String productName);

    /**
     * 标签选择活动商品
     *
     * @param productName
     * @param categoryId
     * @param startTime
     * @param endTime
     * @param mp
     * @return
     */
    IPage<MallGoodsLabelQueryPageDTO> queryByMallLabel(String productName, Long categoryId, Date startTime, Date endTime, Page mp);
}
